<template>
	<view>
		<uni-popup ref="wxShareDialog" type="bottom" :maskClick="false">
			<view class="wx-share">
				<view class="share-opt-area">
					<view class="fs29 ac mb44">分享到</view>
					<view class="share-icon-wrapper flex flex-ver">
						<!-- <button @click="test" class="ac mr64" open-type="share">
							<image class="img" :src="staticImage.friend"></image>
							<view class="fs22">微信好友</view>
						</button> -->
						<view class="ac mr64" @click="share('appMessage')">
							<image class="img" :src="staticImage.friend"></image>
							<view class="fs22">微信好友</view>
						</view>
						<view class="ac" @click="share('timeline')">
							<image class="img" :src="staticImage.timeLine"></image>
							<view class="fs22">朋友圈</view>
						</view>
					</view>
				</view>
				<view class="close-wx-share" @click="$refs.wxShareDialog.close();">取消</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	// import {
	// 	mixinObj
	// } from '@/common/js/mixin.js';
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
	export default {
		// mixins: [mixinObj],
		data() {
			return {
				staticImage: {
					friend:this.$common.imgUrl() + '/other/share_weixin_icon@2x.png',
					timeLine:this.$common.imgUrl() + '/other/share_quan_icon@2x.png',
				}
			}
		},
		props: {
			shareData: {
				type: [Object],
				default () {
					return {}
				}
			},
		},
		computed: {},
		components: {
			uniPopup
		},
		watch:{
			shareData: function(val, old) {
				console.log(val,old);
			},
		},
		created() {
			// console.log(this.entryPage);
		},
		mounted() {
			// this.$refs.wxShareDialog.open();
		},
		methods: {
			// share(shareType){ //appMessage分享朋友  timeline分享朋友圈
			// 	this.$emit('share',shareType);
			// },

			//此组件的分享功能 固定分享 一道题 ，所以请求写在组件中即可；
			// async share(type) {
			// 	const res = await this.reqShare(this.shareData);
			// 	// console.log(res);
			// 	if (res.code && res.code == 200) {
			// 		let options = res.data;
			// 		Object.assign(options, {
			// 			shareType: type
			// 		})
			// 		await this.wxShare(options); //mixin.js中
			// 	}
			// },
			open() {
				this.$refs.wxShareDialog.open();
			},
			close() {
				this.$refs.wxShareDialog.close();
			},
			cancel() {
				this.$emit('cancel');
				this.close();
			},
		}
	}
</script>

<style lang="scss">
	.share-opt-area {
		width: 750rpx;
		height: 294rpx;
		background: #FFFFFF;
		border-radius: 22rpx 22rpx 0 0;
		padding: 42rpx 78rpx 0;
	}

	.share-icon-wrapper {
		.img {
			width: 82rpx;
			height: 82rpx;
		}
	}

	.close-wx-share {
		width: 750rpx;
		height: 137rpx;
		text-align: center;
		line-height: 137rpx;
		background: #F5F5F5;
	}
</style>
